# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=Net-SSLeay
pkgname=perl-${_realname}
pkgver=1.90
pkgrel=1
pkgdesc="Perl extension for using OpenSSL"
arch=('i686' 'x86_64')
license=('custom:BSD')
url="https://metacpan.org/${_realname}/"
groups=('perl-modules')
makedepends=('openssl-devel' 'perl-devel')
depends=('openssl')
options=(!emptydirs)
replaces=('net-ssleay')
provides=('net-ssleay')
source=("https://cpan.metacpan.org/authors/id/C/CH/CHRISN/${_realname}-${pkgver}.tar.gz"
        'Net-SSLeay-1.55.patch')
sha256sums=('f8696cfaca98234679efeedc288a9398fcf77176f1f515dbc589ada7c650dc93'
            'a38e04f08fd71bbafad3c56cdbee73240d0645e231baf13f033723a837022166')

prepare() {
  cd ${srcdir}/${_realname}-${pkgver}

  patch -p1 -i ${srcdir}/Net-SSLeay-1.55.patch
}

build() {
  cd ${srcdir}/${_realname}-${pkgver}

  export OPTIMIZE="$CFLAGS"
  export OPENSSL_PREFIX=/usr

  # install module in vendor directories.
  PERL_MM_USE_DEFAULT=1 perl Makefile.PL -- INSTALLDIRS=vendor
  make
}

package() {
  cd ${srcdir}/${_realname}-${pkgver}

  make install DESTDIR=${pkgdir}
  install -D -m644 README "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
